"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var a;
(function (a) {
    function handlerClass(target) {
        // 这里的target代表Person这个类
        target.prototype.xx = '哈哈哈';
        target.prototype.yy = '人生如梦';
    }
    var Person = /** @class */ (function () {
        function Person() {
        }
        Person = __decorate([
            handlerClass
        ], Person);
        return Person;
    }());
    var p = new Person();
    // console.log(Person.zz)
    // console.log(p.xx)
    // console.log(p.yy)
})(a || (a = {}));
// 属性装饰器 装饰属性
var c;
(function (c) {
    // target如果修饰的是一个普通属性的话，那么这个target指向的是原型Person.prototype
    // target装饰的是一个类的属性static ,那么这个target指向类的定义
    function upperCase(target, propName) {
        var value = target[propName];
        console.log('value:', value);
        var get = function () {
            console.log('get:', value);
            return value;
        };
        var set = function (newVal) {
            console.log('set:', newVal);
            value = newVal.toUpperCase();
        };
        Object.defineProperty(target, propName, {
            get: get,
            set: set,
            configurable: true,
            writable: true,
            enumerable: true
        });
    }
    var Person = /** @class */ (function () {
        function Person() {
            // 表示的是实例的属性
            this.name = 'leichao';
            //    readonly name: string = 'leichao'
        }
        __decorate([
            upperCase
        ], Person.prototype, "name", void 0);
        return Person;
    }());
    var p = new Person();
    p.name = 'jiagou';
    console.log(p.name);
})(c || (c = {}));
